import Mock from 'mockjs'

const loginData = {
  login: (config) => {
    const { username, password } = JSON.parse(config.body)

    if (username === 'admin' && (password === '123456' || password === 'admin')) {
      return {
        status: 200,
        message: '登录成功',
        data: {
          token: Mock.Random.string(32),  // 模拟一个 32 位的 token
        },
      }
    } else {
      return {
        code: 400,
        message: '用户名或密码错误',
      };
    }

  }
}

export default loginData